#!/bin/sh /etc/rc.common
# Bulkdata Software
# Copyright (C) 2019 iopsys Software Solutions AB
# Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>

START=99
STOP=10

USE_PROCD=1
PROG="/usr/sbin/icwmp_bulkdatad"

start_service() {
	local bulkdata_enable=`uci -q get cwmp_bulkdata.bulkdata.enable`
	if [ "$bulkdata_enable" = "1" ]; then
		procd_open_instance
		procd_set_param command "$PROG"
		procd_set_param respawn "3" "7" "0"
		procd_close_instance
	fi
}

boot() {
	start
}

reload_service() {
	stop
	start 
}

service_triggers()
{
	procd_add_reload_trigger cwmp_bulkdata
}
